import { Frame } from "./Frame";
import { FrameUtil } from "../FrameUtil";
type int = number;
//class TimerFrame
    
    internal class TimerFrame extends Frame
    {
        public TimerFrame(arg1: number=1)
        {
            super(arg1 * 1000);
            this._timer = new Object /* flash.utils.Timer */(this._delayConst);
            return;
        }

        public /* override */ play(): void
        {
            super.play();
            this._timer.addEventListener(flash.events.TimerEvent.TIMER, this.onEnterFrameHandler);
            this._startTimer = flash.utils.getTimer();
            this._accruedTime = 0;
            this._timer.start();
            return;
        }

        protected /* override */ onEnterFrameHandler(arg1: Object /* flash.events.Event */=null): void
        {
            var loc1=flash.utils.getTimer();
            this._accruedTime = this._accruedTime + (loc1 - this._startTimer);
            if (this._accruedTime >= delay) 
            {
                renderer(this._accruedTime);
                this._accruedTime = this._accruedTime - delay;
            }
            this._startTimer = flash.utils.getTimer();
            FrameUtil.timerProTimer = FrameUtil.timerProTimer + (this._startTimer - loc1);
            return;
        }

        public /* override */ stop(): void
        {
            super.stop();
            this._timer.stop();
            this._timer.removeEventListener(flash.events.TimerEvent.TIMER, this.onEnterFrameHandler);
            return;
        }

        private /* var */_timer: Object /* flash.utils.Timer */;

        private /* var */_startTimer: int;

        private /* var */_delayConst: int=100;

        private /* var */_accruedTime: int;
    }
